{extend name='admin@main'}
{block name='content'}
<style>
    .store-total-container {
        font-size: 14px;
        margin-bottom: 20px;
        letter-spacing: 1px;
    }
    .store-total-container .store-total-item > div:nth-child(2) {
        font-size: 46px;
        line-height: 46px;
    }
    @media screen and (min-device-width: 992px) {
        .game_distribution {
            width: 50%;
        }
    }
    ::-webkit-scrollbar {width: 10px;height: 10px;background-color: rgba(240, 240, 240, 1);}
</style>
<div class="think-box-shadow">
    {notempty name='$room_list'}
    <div class="layui_table_width_scroll_38" >
        {include file='user/real_user_search'}
        <div class="margin-bottom-15">房间在线实时人数 <b style="font-size: 12px;color: #ccc;"></b></div>
        <table class="layui-table" lay-skin="line" >
            <thead>
            <tr>
                <th class="text-left">所在房间</th>
                <th class="text-left nowrap">在线人数</th>
            </tr>
            </thead>
            <tbody>
            {foreach $room_list as $key=>$vo}
            <tr>
                <td class='text-left nowrap'>
                    <span class="color-blue">{$vo.name}</span>
                </td>
                <td class='text-left nowrap'>
                    <span class="color-red">{$vo.count}</span>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
    <table class="layui-table margin-top-10" lay-skin="line" >
        <thead>
        <tr>
            <th class="text-left nowrap" style="padding-left: 3em;" >合计</th>
            <th class='text-left nowrap'>总人数:<?php echo array_sum(array_column($room_list,'count')); ?>人</th>
        </tr>
        </thead>
    </table>
    <div class="think-box-shadow store-total-container notselect" >
        <div class="layui-row layui-col-space15">
            <div class="margin-bottom-15">玩家房间实时在线人数 <b style="font-size: 12px;color: #ccc;"></b></div>
            <div id="time_room_online" style="height:400px;" >
            </div>
        </div>
    </div>
    <script>
        require(['echarts'], function (echarts, chart) {
            chart = echarts.init(document.getElementById('time_room_online'));
            window.onresize = chart.resize;
            option = {
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    data:['房间实时在线人数']
                },
                toolbox: {
                    orient: 'vertical',
                    x: 'right',
                    y: 'center',
                    show : true,
                    feature : {
                        mark : {show: true},
                        dataView : {show: true, readOnly: false},
                        magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                        restore : {show: true},
                        saveAsImage : {show: true}
                    }
                },
                grid: {
                    left: '5%',
                    right: '8%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data :eval('{:json_encode($user_real_room_trend.name)}'),
                        axisLabel:{
                            interval: 0,  //控制坐标轴刻度标签的显示间隔.设置成 0 强制显示所有标签。设置为 1，隔一个标签显示一个标签。设置为2，间隔2个标签。以此类推
                            rotate:45,//倾斜度 -90 至 90 默认为0
                            textStyle:{
                                fontWeight:"bold",  //加粗
                                color:"#000000"   //黑色
                            },
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value',
                        axisLabel: {
                            color: '#2f9de2',
                            formatter: "{value}人"
                        },
                        splitLine: {
                            lineStyle: {
                                type: 'dashed',
                                color: '#cccccc'
                            }
                        },
                        minInterval: 1
                    }
                ],
                series : [
                    {
                        name:'房间实时在线人数',
                        type:'bar',
                        stack: '总量',
                        data: eval('{:json_encode($user_real_room_trend.count)}'),
                        barWidth:50,
                        barMaxWidth:30,
                        lineStyle: {
                            normal: {
                                color: '#2f9de2',
                                width: 1,
                                /*type: 'dashed'*/
                            }
                        },
                        itemStyle: {
                            normal: {
                                borderWidth: 1,
                                borderColor: '#ff7d7d',
                                color: '#c543d8'
                            }
                        }
                    },
                ]
            };
            chart.setOption(option);
        });
    </script>
    <div class="layui_table_width_scroll_38" >
        <div class="margin-bottom-15">渠道在线实时人数 <b style="font-size: 12px;color: #ccc;"></b></div>
        <table class="layui-table" lay-skin="line" >
            <thead>
            <tr>
                <th class="text-left">所在渠道</th>
                <th class="text-left nowrap">在线人数</th>
            </tr>
            </thead>
            <tbody>
            {foreach $spreader_list as $key=>$vo}
            <tr>
                <td class='text-left nowrap'>
                    <span class="color-blue">{$vo.name}</span>
                </td>
                <td class='text-left nowrap'>
                    <span class="color-red">{$vo.count}</span>
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
    <table class="layui-table margin-top-10" lay-skin="line" >
        <thead>
        <tr>
            <th class="text-left nowrap" style="padding-left: 3em;" >合计</th>
            <th class='text-left nowrap'>总人数:<?php echo array_sum(array_column($spreader_list,'count')); ?>人</th>
        </tr>
        </thead>
    </table>
    <div class="think-box-shadow store-total-container notselect" >
        <div class="layui-row layui-col-space15">
            <div class="margin-bottom-15">玩家渠道实时在线人数 <b style="font-size: 12px;color: #ccc;"></b></div>
            <div id="time_channel_online" style="height:400px;" >
            </div>
        </div>
    </div>
    <script>
        require(['echarts'], function (echarts, chart) {
            chart = echarts.init(document.getElementById('time_channel_online'));
            window.onresize = chart.resize;
            option = {
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    data:['渠道实时在线人数']
                },
                toolbox: {
                    orient: 'vertical',
                    x: 'right',
                    y: 'center',
                    show : true,
                    feature : {
                        mark : {show: true},
                        dataView : {show: true, readOnly: false},
                        magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                        restore : {show: true},
                        saveAsImage : {show: true}
                    }
                },
                grid: {
                    left: '5%',
                    right: '8%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data :eval('{:json_encode($user_real_spreader_trend.name)}'),
                        axisLabel:{
                            interval: 0,  //控制坐标轴刻度标签的显示间隔.设置成 0 强制显示所有标签。设置为 1，隔一个标签显示一个标签。设置为2，间隔2个标签。以此类推
                            rotate:45,//倾斜度 -90 至 90 默认为0
                            textStyle:{
                                fontWeight:"bold",  //加粗
                                color:"#000000"   //黑色
                            },
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value',
                        axisLabel: {
                            color: '#2f9de2',
                            formatter: "{value}人"
                        },
                        splitLine: {
                            lineStyle: {
                                type: 'dashed',
                                color: '#cccccc'
                            }
                        },
                        minInterval: 1
                    }
                ],
                series : [
                    {
                        name:'渠道实时在线人数',
                        type:'bar',
                        stack: '总量',
                        data: eval('{:json_encode($user_real_spreader_trend.count)}'),
                        barWidth:50,
                        barMaxWidth:30,
                        lineStyle: {
                            normal: {
                                color: '#2f9de2',
                                width: 1,
                                /*type: 'dashed'*/
                            }
                        },
                        itemStyle: {
                            normal: {
                                borderWidth: 1,
                                borderColor: '#ff7d7d',
                                color: '#c543d8'
                            }
                        }
                    },
                ]
            };
            chart.setOption(option);
        });
    </script>

    {else/}
    <span class="notdata">没有记录哦</span>
    {/notempty}
    {/block}
</div>